//
//  common.h
//  NVAReader
//
//  Created by DuyLK on 6/4/14.
//  Copyright (c) 2014 com.nva.nvareader. All rights reserved.
//

#import <Foundation/Foundation.h>
#undef ABS
#undef MIN
#undef MAX

#include "mupdf/fitz.h"
#include "dispatch/dispatch.h"


extern fz_context *ctx;
extern dispatch_queue_t queue;
extern float screenScale;

CGSize fitPageToScreen(CGSize page, CGSize screen);

int search_page(fz_document *doc, int number, char *needle, fz_cookie *cookie);

fz_rect search_result_bbox(fz_document *doc, int i);

CGDataProviderRef wrapPixmap(fz_pixmap *pix);

CGImageRef newCGImageWithPixmap(fz_pixmap *pix, CGDataProviderRef cgdata);

int colorCode (NSColor *color);

NSColor* colorDecode(int color);